package com.hllxd.hism.passport.login.gateway.util;

/**
 * Created with IntelliJ IDEA.
 * User: dongzhao.dz
 * Date: 14-5-12
 * Time: 下午3:24
 * To change this template use File | Settings | File Templates.
 */
public class ThreadLocalManager {
    private static final ThreadLocal<ConsoleContext> manager = new ThreadLocal<ConsoleContext>();

    public static void setConsoleContext(ConsoleContext consoleContext) {
        ConsoleContext context = getConsoleContext();
        if (context != null) {
            manager.remove();
        }
        manager.set(consoleContext);
    }

    public static ConsoleContext getConsoleContext() {
        return manager.get();
    }

    public static void clear() {
        manager.remove();
    }
}
